import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from '../views/homes/Home.vue'
import store from '../store'

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/pageRound',
    name: 'pageRound',
    component: () => import(/* webpackChunkName: pageRound */ '@/views/pageRound/index.vue'),
  },
]

const router = new VueRouter({
  routes
})
router.afterEach((to, from) => {
  if (to.meta.breadcrumbs && Array.isArray(to.meta.breadcrumbs)) {
    store.state.breadcrumbs = to.meta.breadcrumbs;
  }
});

export default router
